package text111;

import java.util.Stack;

public class CQueue {

		Stack<Integer> A;
			Stack<Integer> B;
			
			public CQueue() {
				A = new Stack<Integer>();
				B = new Stack<Integer>();	
			}
			//插入尾部
		    public void appendTail(int value) {
		    	A.push(value);
		    }
		    //删除队列头部
		    public int deleteHead() {
		        //b不空，
		        if(!B.empty()){
		            return B.pop();
		        }
		        //b空a空
		        if(A.empty()){
		            return -1;
		        }
		        //b空a不空
		        while(!A.empty()){
		            B.push(A.pop());
		        }
		        return B.pop();
		    }
		}

		/**
		 * Your CQueue object will be instantiated and called as such:
		 * CQueue obj = new CQueue();
		 * obj.appendTail(value);
		 * int param_2 = obj.deleteHead();
		 */

